package com.ss.android.account.model;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.Gson;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken;
import com.ss.android.account.a.a;

import org.json.JSONException;
import org.json.JSONObject;

public class UserModel extends BaseModel implements Parcelable {
    public static final Parcelable.Creator CREATOR;
    @SerializedName("area")
    private String area;
    @SerializedName("avatar_url")
    private String avatarUrl;
    @SerializedName("birthday")
    private String birthday;
    @SerializedName("create_time")
    private String createTime;
    @SerializedName("followers_count")
    private int followersCount;
    @SerializedName("followings_count")
    private int followingsCount;
    @SerializedName("gender")
    private String gender;
    @SerializedName("industry")
    private String industry;
    @SerializedName("is_blocking")
    private int is_blocking;
    @SerializedName("media_id")
    private long mediaId;
    @SerializedName("punish_status")
    private String punishStatus;
    @SerializedName("screen_name")
    private String screenName;
    @SerializedName("share_url")
    private String shareUrl;
    @SerializedName("user_auth_info")
    private String userAuthInfo;
    @JsonAdapter(a.class)
    @SerializedName("user_id")
    private long userId;
    @SerializedName("name")
    private String userName;
    @SerializedName("user_type")
    private String userType;
    @SerializedName("user_verified")
    private String userVerified;
    @SerializedName("visit_count_recent")
    private int visitCountRecent;

    static {
        CREATOR = new Creator<UserModel>(){
            public final UserModel createFromParcel(Parcel arg2) {
                return new UserModel(arg2);
            }

            public final UserModel[] newArray(int arg2) {
                return new UserModel[arg2];
            }
        };
    }

    protected UserModel(Parcel arg3) {
        super(arg3);
        this.userId = arg3.readLong();
        this.mediaId = arg3.readLong();
        this.userName = arg3.readString();
        this.avatarUrl = arg3.readString();
        this.shareUrl = arg3.readString();
        this.is_blocking = arg3.readInt();
        this.followingsCount = arg3.readInt();
        this.followersCount = arg3.readInt();
        this.visitCountRecent = arg3.readInt();
        this.screenName = arg3.readString();
        this.gender = arg3.readString();
        this.userType = arg3.readString();
        this.userVerified = arg3.readString();
        this.createTime = arg3.readString();
        this.punishStatus = arg3.readString();
        this.userAuthInfo = arg3.readString();
        this.area = arg3.readString();
        this.birthday = arg3.readString();
        this.industry = arg3.readString();
    }

    public UserModel() {

    }

    public UserInfoModel convertUserInfoModel() {
        UserInfoModel v1 = new UserInfoModel();
        if (!android.support.design.a.isTextEmpty(this.userAuthInfo)) {
            try {
                String v0_1 = new JSONObject(this.userAuthInfo).optString("auth_type");
                if (!android.support.design.a.isTextEmpty(v0_1)) {
                    v1.setUserAuthType(v0_1);
                    v1.setVerifiedViewVisible(true);
                } else {
                    v1.setVerifiedViewVisible(false);
                }
            } catch (JSONException v0) {
                v0.printStackTrace();
            }
        } else {
            v1.setVerifiedViewVisible(false);
        }
        v1.setAvatarUrl(this.avatarUrl);
        v1.setName(this.userName);
        v1.setVerifiedInfoVisible(false);
        return v1;
    }

    public int describeContents() {
        return 0;
    }

    public String getArea() {
        return this.area;
    }

    public String getAvatarUrl() {
        return this.avatarUrl;
    }

    public String getBirthday() {
        return this.birthday;
    }

    public String getCreateTime() {
        return this.createTime;
    }

    public int getFollowersCount() {
        return this.followersCount;
    }

    public int getFollowingsCount() {
        return this.followingsCount;
    }

    public String getGender() {
        return this.gender;
    }

    public String getIndustry() {
        return this.industry;
    }

    public long getMediaId() {
        return this.mediaId;
    }

    public String getPunishStatus() {
        return this.punishStatus;
    }

    public String getScreenName() {
        return this.screenName;
    }

    public String getShareUrl() {
        return this.shareUrl;
    }

    public String getUserAuthInfo() {
        return this.userAuthInfo;
    }

    public long getUserId() {
        return this.userId;
    }

    public String getUserName() {
        return this.userName;
    }

    public String getUserType() {
        return this.userType;
    }

    public String getUserVerified() {
        return this.userVerified;
    }

    public int getVisitCountRecent() {
        return this.visitCountRecent;
    }

    public boolean isBlocking() {
        boolean v0 = this.is_blocking != 0 ? true : false;
        return v0;
    }

    public static UserModel parse(JSONObject arg3) {
        return (UserModel) new Gson().fromJson(arg3.toString(), new TypeToken<UserModel>() {
        }.getType());
    }

    public void setArea(String arg1) {
        this.area = arg1;
    }

    public void setAvatarUrl(String arg1) {
        this.avatarUrl = arg1;
    }

    public void setBirthday(String arg1) {
        this.birthday = arg1;
    }

    public void setBlocking(boolean arg2) {
        int v0 = arg2 ? 1 : 0;
        this.is_blocking = v0;
    }

    public void setCreateTime(String arg1) {
        this.createTime = arg1;
    }

    public void setFollowersCount(int arg1) {
        this.followersCount = arg1;
    }

    public void setFollowingsCount(int arg1) {
        this.followingsCount = arg1;
    }

    public void setGender(String arg1) {
        this.gender = arg1;
    }

    public void setIndustry(String arg1) {
        this.industry = arg1;
    }

    public void setMediaId(long arg2) {
        this.mediaId = arg2;
    }

    public void setPunishStatus(String arg1) {
        this.punishStatus = arg1;
    }

    public void setScreenName(String arg1) {
        this.screenName = arg1;
    }

    public void setShareUrl(String arg1) {
        this.shareUrl = arg1;
    }

    public void setUserAuthInfo(String arg1) {
        this.userAuthInfo = arg1;
    }

    public void setUserId(long arg2) {
        this.userId = arg2;
    }

    public void setUserName(String arg1) {
        this.userName = arg1;
    }

    public void setUserType(String arg1) {
        this.userType = arg1;
    }

    public void setUserVerified(String arg1) {
        this.userVerified = arg1;
    }

    public void setVisitCountRecent(int arg1) {
        this.visitCountRecent = arg1;
    }

    public void writeToParcel(Parcel arg3, int arg4) {
        super.writeToParcel(arg3, arg4);
        arg3.writeLong(this.userId);
        arg3.writeLong(this.mediaId);
        arg3.writeString(this.userName);
        arg3.writeString(this.avatarUrl);
        arg3.writeString(this.shareUrl);
        arg3.writeInt(this.is_blocking);
        arg3.writeInt(this.followingsCount);
        arg3.writeInt(this.followersCount);
        arg3.writeInt(this.visitCountRecent);
        arg3.writeString(this.screenName);
        arg3.writeString(this.gender);
        arg3.writeString(this.userType);
        arg3.writeString(this.userVerified);
        arg3.writeString(this.createTime);
        arg3.writeString(this.punishStatus);
        arg3.writeString(this.userAuthInfo);
        arg3.writeString(this.area);
        arg3.writeString(this.birthday);
        arg3.writeString(this.industry);
    }
}

